<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "product".
 *
 * @property string $product_id
 * @property string $seoURL
 * @property string $name
 * @property string $detail
 * @property string $category_id
 * @property string $price
 * @property string $old_price
 * @property string $image
 * @property string $thumb
 * @property string $vendor
 * @property string $made_in
 * @property integer $new
 * @property integer $popular
 * @property integer $favorite
 * @property integer $sale
 * @property string $tags
 * @property integer $remains
 */
class Product extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'product';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['seoURL', 'name', 'category_id'], 'required'],
            [['detail', 'tags'], 'string'],
            [['category_id', 'vendor', 'new', 'popular', 'favorite', 'sale', 'remains'], 'integer'],
            [['price', 'old_price'], 'number'],
            [['seoURL', 'name', 'image', 'thumb'], 'string', 'max' => 255],
            [['made_in'], 'string', 'max' => 100]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'product_id' => Yii::t('app', 'Product ID'),
            'seoURL' => Yii::t('app', 'Seo Url'),
            'name' => Yii::t('app', 'Name'),
            'detail' => Yii::t('app', 'Detail'),
            'category_id' => Yii::t('app', 'Category ID'),
            'price' => Yii::t('app', 'Price'),
            'old_price' => Yii::t('app', 'Old Price'),
            'image' => Yii::t('app', 'Image'),
            'thumb' => Yii::t('app', 'Thumb'),
            'vendor' => Yii::t('app', 'Vendor'),
            'made_in' => Yii::t('app', 'Made In'),
            'new' => Yii::t('app', 'New'),
            'popular' => Yii::t('app', 'Popular'),
            'favorite' => Yii::t('app', 'Favorite'),
            'sale' => Yii::t('app', 'Sale'),
            'tags' => Yii::t('app', 'Tags'),
            'remains' => Yii::t('app', 'Remains'),
        ];
    }
}
